(function ($, im, doc) {
	$.plusReady(function () {
        window.addEventListener('SENDFAV', function(event) {
            var uinfo = event.detail;
            document.querySelector('#sendProfile').style.display = 'block';
            document.querySelector('#toName span').innerText = im.chatName;
            document.querySelector('#toName img').setAttribute('src',im.header);
            if(uinfo.ctype == 1){
                document.querySelector('#fromName .span1').innerText = '[笔记]';
			}else if(uinfo.ctype == 2){
                document.querySelector('#fromName .span1').innerText = '';
			}

            if(uinfo.c_msg != ''){
                document.querySelector('#fromName .span2').innerText = uinfo.c_msg;
			}else{
            	var img = document.createElement('img');
            	img.src = uinfo.c_img;
            	img.style.width = '70px';
            	img.style.height = '70px';
            	img.style.verticalAlign = 'middle';
            	img.style.marginLeft = '20%';
            	document.querySelector('#sendProfile > div').style.maxHeight = '300px';
            	document.querySelector('#sendProfile > div #fromName').style.height = '80px';
            	document.querySelector('#sendProfile > div #fromName').style.lineHeight = '80px';
                document.querySelector('#fromName .span2').innerText = '';
				document.querySelector('#fromName .span2').appendChild(img);
			}

            document.querySelector('#fromName').setAttribute('fid',uinfo.fid);
            document.querySelector('#fromName').setAttribute('head',uinfo.head);
            document.querySelector('#fromName').setAttribute('title',uinfo.title);
            document.querySelector('#fromName').setAttribute('pattern','fav');
            document.querySelector('#fromName').setAttribute('c_msg',uinfo.c_msg);
            document.querySelector('#fromName').setAttribute('c_img',uinfo.c_img);
            document.querySelector('#fromName').setAttribute('cname',uinfo.cname);
            //document.querySelector('#fromName').setAttribute('phone',uinfo.phone);
            // document.querySelector('#fromName').setAttribute('c_msg',uinfo.c_msg);
            // document.querySelector('#fromName').setAttribute('c_img',uinfo.c_img);
        });

//		document.getElementById("myfavorites").addEventListener('tap', function () {
//			mui.openWindow({
//              url: "/pages/favorites/index_send.html",
//              id: "favorites",
//              extras: im.extraWin
//          });
//		});
       
	});

	
}(mui, im, document));